import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { plasmoVite } from "plasmo";

export default defineConfig({
  plugins: [
    plasmoVite(), // 正确使用具名导出的插件函数
    react({
      // 必须添加 babel 配置 
      babel: {
        plugins: [
          ["import", { libraryName: "antd", libraryDirectory: "es", style: "css" }]
        ]
      }
    })
  ],
  css: {
    preprocessorOptions: {
      less: {
        javascriptEnabled: true // 允许 JS 修改 LESS 变量
      }
    }
  }
});